import React from "react";

import { DataAction, IProTableRef } from "vendor/components/pro-table-native";
import { getLoginLogPageList, deleteLoginLog } from "../../api";

export const getDataAction = (proTableRef: React.MutableRefObject<IProTableRef>): DataAction => ({
    fetchList: (params) => {
        const { page, pageSize, filter } = params;
        const filterClone = {...filter};

        return new Promise((resolve, reject) => getLoginLogPageList(Object.assign({page,pageSize}, filterClone || {})).then((resp) => resolve(resp.data)).catch((e) => reject(e)))
    },
    deleteItems: (selectedRowKeys) => {
        return deleteLoginLog(selectedRowKeys.map((item) => parseInt(item)))
    },
})


